package com.xyht.medicine_management_system.common.commonReturn;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author Ikaros
 * @date 2020/1/26 16:58
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum CommonCodeEnum{

    /**
     * 通用错误代码
     */
    SUCCESS(true, 2000, "操作成功！"),
    INVALID_PARAM(false, 4001, "无效参数"),
    INVALID_PARAM_FORMAT(false, 4001, "无效参数,请按指定格式填写"),
    DATA_INTEGRITY_VIOLATION_EXCEPTION(false, 4002, "数据完整性约束异常"),
    DATA_OVER_LENGTH_EXCEPTION(false, 4002, "数据过长"),
    DATA_SIZE_LIMIT_EXCEPTION(false, 4002, "内容过多超出规定限制"),
    DATA_EXIST(false, 4006, "数据重复"),
    DATA_DECODE_FAIL(false, 4006, "数据解密失败"),
    JSON_PARSE_ERROR0(false, 4003, "json解析失败"),
    FILE_SIZE_LIMIT_EXCEEDED(false, 4004, "上传文件过大"),
    FILE_SIZE_LIMIT_MIN(false, 4004, "上传文件无效"),
    IO_EXCEPTION(false, 4005, "IO异常"),
    DATA_NOT_FOUND(false, 5000, "数据不存在"),
    FAIL(false, 4000, "程序异常，操作失败！"),
    SERVER_ERROR(false, 4055, "系统繁忙，请稍后重试！"),
    UPDATE_FAIL(false,4005,"修改失败"),
    DELETE_FAIL(false,4006,"删除失败"),
    ADD_FAIL(false,4006,"添加失败"),
    REQUEST_TIMEOUT(false,4006,"请求超时"),
    REQUEST_REPEAT(false,4006,"请求过快"),
    CLIENT_FLAG_CHECK_FAIL(false,4006,"系统标识不存在"),

    INVALID_COlUMN(false, 4013, "无效字段，请选择需要导出字段"),

    /**
     * Mqtt相关
     */
    SEND_MESSAGE_TO_SPECIFIED_TOPIC_FAILED(false, 4001, "向指定主题中,发送消息失败(MQTT)"),

    /**
     * 用户相关
     */
    USERNAME_OR_PASSWORD_ERROR(false, 4112, "用户名或密码错误"),
    OLD_PASSWORD_ERROR(false, 4112, "用户原密码错误"),
    OLD_PASSWORD_LIKE_NEW_PASSWORD(false, 4112, "新密码与原密码相同"),
    ACCOUNT_ERR(false, 4113, "账号异常"),
    ACCOUNT_CAN_NOT_USE(false, 4113, "账号不可用或未激活"),
    VERIFY_CODE_CHECK_FAIL(false, 4111, "验证码错误"),
    TOKEN_CHECK_FAIL(false, 4110, "验证失败，请重新登录"),
    TOKEN_TIME_OUT(false, 4101, "登录超时，请重新登录"),
    UNAUTHORIZED(false, 4113, "暂未登录或登录超时,请重新登录"),
    RE_LOGIN(false, 4102, "请重新登陆"),
    PERMISSION_DENY(false, 4103, "没有操作权限"),
    TEL_EXIST(false, 4104, "手机号已注册"),
    TEL_FORMAT_ERROR(false, 4104, "手机号格式错误"),
    TEL_BIND_ERROR(false, 4104, "请输入当前账号绑定手机号"),
    TEL_NOT_BIND(false, 4104, "手机号未绑定账号"),
    ACCOUNT_EXIST(false, 4105, "用户名已注册"),
    ACCOUNT_ILLEGAL(false, 4106, "用户名格式错误"),
    USER_ACCOUNT_EXIST(false, 4107, "用户已注册"),
    USER_NOT_EXIST(false, 4108, "用户不存在"),
    CODE_GET_FAIL(false, 4108, "请勿重复获取手机验证码"),
    CODE_OVERFLOW(false, 4109, "今日当前手机验证码发送已达上限"),
    WX_MP_NOT_BIND(false, 4109, "未绑定公众号"),
    WX_MP_BIND_FAIL(false, 4109, "绑定失败"),
    WX_MA_NOT_REGISTER_ACCOUNT(false, 4109, "绑定失败，请在《知行东方》小程序注册账号"),
    WX_MP_MINI_APP_NOT_FIND(false, 4109, "该微信号未绑定任何本平台小程序账号，绑定失败"),

    /**
     * 权限管理
     */
    AUTH_APP_NOT_EXIST(false,4300,"界面应用不存在"),
    AUTH_RES_NOT_EXIST(false,4300,"权限资源不存在"),
    AUTH_DENY(false,4300,"权限不足"),

    ;


    private boolean success;
    private int code;
    private String msg;

    CommonCodeEnum(boolean success, int code, String msg) {
        this.success = success;
        this.code = code;
        this.msg = msg;
    }

    public boolean getSuccess() {
        return success;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
